#ifndef VSCLODTERRAINNODE_H
#define VSCLODTERRAINNODE_H
#include "VSTerrainNode.h"
namespace VSEngine2
{
	class VSStream;
	class VSGRAPHIC_API VSCLodTerrainNode : public VSTerrainNode
	{
		//PRIORITY
		
		//RTTI
		DECLARE_RTTI;
		DECLARE_INITIAL
	public:
		enum //Terrain Node Type
		{
			TNT_ROAM,
			TNT_QUAD,
			TNT_MAX
		};
		VSCLodTerrainNode(unsigned int uiTerrainNodeType);
		virtual ~VSCLodTerrainNode();
		VSCLodTerrainNode();
	public:

		virtual unsigned int DiskUse()const;

		virtual bool Save(VSStream & rStream,unsigned int &iSaveUse)const;
		virtual bool Load(VSStream & rStream,unsigned int &iSaveUse);

	public:
		virtual bool Clone(const VSObject *pObject,unsigned int uiType);
	protected:
		

		
		VSREAL	m_fScale;

		unsigned int m_uiTerrainNodeType;
		void LinkNeighbor();
		void ComputeVariance();

		virtual bool CreateChild();
		virtual void UpdateNodeAll(double dAppTime);
	public:
		virtual unsigned int AddChild(VSSpatial * pChild);

		void SetScale(VSREAL fScale);

		inline VSREAL GetScale()const {return m_fScale;}

		void SetTerrainNodeType(unsigned int uiTerrainNodeType);
	};
	DECLARE_Ptr(VSCLodTerrainNode);
	VSTYPE_MARCO(VSCLodTerrainNode);
}
#endif